package com.mybatis.demo;

import org.apache.ibatis.datasource.unpooled.UnpooledDataSourceFactory;

import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import com.zaxxer.hikari.util.JavassistProxyFactory;

public class HikariDataSourceFactory extends UnpooledDataSourceFactory {
	
	public HikariDataSourceFactory() {
		// 通过jar包引用就不需要这么写了，因为在打包的时候会执行JavassistProxyFactory的main直接把jar文件打包进去
		JavassistProxyFactory.createProxy();
		HikariConfig config = new HikariConfig("/hikariPool.properties");
		config.setMaximumPoolSize(5);
		this.dataSource = new HikariDataSource(config);
	}
	
}